package com.sharing.util;

import org.apache.logging.log4j.message.ReusableMessage;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * @author MingTian
 * @version 1.0
 * @description TODO 项目中对字符串进行特定操作的工具类
 * @date 2023/4/11 22:29
 */
public class StringUtils {
    public static boolean compareStrings(String s1, String s2) {
        String[] strings1 = s1.split(" ");
        String[] strings2 = s2.split(" ");
        String date1 = strings1[0];
        String date2 = strings2[0];
        String time1 = strings1[1];
        String time2 = strings2[1];

        // 比较日期
        for (int i = 0; i < date1.length(); i++) {
            if (date1.charAt(i) == date2.charAt(i)) {
                continue;
            } else {
                if (date1.charAt(i) < date2.charAt(i)) {
                    return true;
                } else {
                    return false;
                }
            }
        }

        // 比较时间
        for (int i = 0; i < time1.length(); i++) {
            if (time1.charAt(i) == time2.charAt(i)) {
                continue;
            } else {
                if (time1.charAt(i) < time2.charAt(i)) {
                    return true;
                } else {
                    return false;
                }
            }
        }
        return true;
    }
}
